-# locals: object
-all_object_people = object.object_people.all

%li.tab-title-holder
  .item-main
    .item-title
      .row-fluid
        .span12
          .js-list-container-title
            %h3.tab-title
              People
              %span{:class => "grc-badge #{all_object_people.count.zero? ? "no-object" : ""}"}
                (#{all_object_people.count})
              %a.pull-right{:href => list_edit_flow_object_people_path(:object_type => object.class.name, :object_id => object.id), :'data-toggle' => 'modal-ajax-relationship-selector', :'data-modal-reset' => 'reset', :'data-list-target' => '#personList', :'data-modal-class' => 'modal-wide', :rel => "tooltip", :'data-placement'=> "left", :title => "Link People"}
                %i.grcicon-link

  %script#person_list_item{ :type => 'text/html', :'data-member' => 'object_person' }
    %li.controlSlot{ :'data-id' => '<%= person.id %>' }
      .item-main
        .item-title
          .row-fluid
            .span12
              .oneline
                %span.addition-info
                  %a{:href => 'mailto:<%= person.email %>', :rel => "tooltip", :title => "<%= person.email %>"} <%= person.name && person.name.trim() || person.email %>
                  %span.role
                    <%= role %>

  %ul#personList.tree-structure{ :'data-template-id' => 'person_list_item' }
    -all_object_people.each do |object_item|
      -item = object_item.person
      %li{ :'data-id' => item.id }
        .item-main
          .item-title
            .row-fluid
              .span12
                .oneline
                  %span.addition-info
                    -if item.name.presence && item.email.presence
                      %a{:href=>"mailto:#{item.email}", :target=>"_blank", :rel => "tooltip", :title => "#{item.email}"}=item.name
                    -elsif item.name.presence
                      =item.name
                    -elsif item.email.presence
                      %a{:href=>"mailto:#{item.email}", :target=>"_blank"}=item.email
                    -else
                      ="&nbsp".html_safe
                    %span.role
                      =object_item.role